{template 'common/header-base'}
<ul class="nav nav-tabs">
  <li{if $op == "display"} class="active"{/if}><a href="{php echo $this->createWebUrl('xiangmu_type',array('op' =>'display'))}">父级分类</a></li>
  <li{if $op == "post"} class="active"{/if}><a href="{php echo $this->createWebUrl('xiangmu_type',array('op' =>'post'))}">添加父级分类</a></li>
  <li{if $op == 'displays'} class="active"{/if}><a href="{php echo $this->createWebUrl('xiangmu_type',array('op' => 'displays'))}">二级分类</a></li>
  <li{if $op == 'posts'} class="active"{/if}><a href="{php echo $this->createWebUrl('xiangmu_type',array('op' => 'posts'))}">添加二级分类</a></li>
</ul>
{if $op == 'display'}
<form class="form-horizontal" action="" method="post">
    <table class="table we7-table table-hover article-list vertical-middle">
        <tr>
            <td>排序</td>
            <td>服务分类名称</td>
            <td>服务分类图标</td>
            <td>是否使用</td>
            <td class="text-right">操作</td>
        </tr>
        {loop $products $item}
        <tr>
            <td>
                {$item['xt_idss']}
            </td>
            <td>
                {$item['xt_name']}
            </td>
            <td>
                <img src="{media $item['xt_thumb']}" style="width: 80px;height: 80px;" alt="">
            </td>
            <td>
                {$item['xt_ids']}
            </td>
            <td class="text-right">
                <a class="btn btn-default btn-sm" href="{php echo $this->createWeburl('xiangmu_type', array('xt_id' => $item['xt_id'], 'op' =>'post'))}" >编辑</a>
                <a class="btn btn-default btn-sm" onclick="return confirm('此操作不可恢复，确认吗？'); return false;" href="{php echo $this->createWeburl('xiangmu_type', array('xt_id' => $item['xt_id'], 'op' => 'delete'))}">删除</a>
            </td>
        </tr>
        {/loop}
    </table>
</form>
{/if}
{if $op == 'post'}
<form class="form-horizontal" action="" method="post">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">添加服务分类</h3>
        </div>
        <div class="panel-body">
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >排序</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="xt_idss" name="xt_idss" value="{$items['xt_idss']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">排序[数字越大越靠前]</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >服务分类名称</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="xt_name" name="xt_name" value="{$items['xt_name']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">服务分类名称</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >服务分类图标</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    {php echo tpl_form_field_image('xt_thumb', $items['xt_thumb'])}
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">服务分类图标</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >是否使用</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <select name="xt_ids" id="xt_ids" class="form-control">
                        <option value="">--请选择--</option>
                        <option value="是" {if $items['xt_ids']=="是"}selected{/if} >是</option>
                        <option value="否" {if $items['xt_ids']=="否"}selected{/if} >否</option>
                    </select>
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block"></div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-12">
            <input name="token" type="hidden" value="{$_W['token']}" />
            <input type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交" style="margin-left: 45%;" />
        </div>
    </div>
</form>
{/if} 
{if $op == 'displays'}
<form class="form-horizontal" action="" method="post">
    <table class="table we7-table table-hover article-list vertical-middle">
        <tr>
            <td>排序</td>
            <td>服务分类名称</td>
            <td>服务分类图标</td>
            <td>父级分类名称</td>
            <td>是否使用</td>
            <td class="text-right">操作</td>
        </tr>
        {loop $products $item}
        <tr>
            <td>
                {$item['xt_idss']}
            </td>
            <td>
                {$item['xt_name']}
            </td>
            <td>
                <img src="{media $item['xt_thumb']}" style="width: 80px;height: 80px;" alt="">
            </td>
            <td>
                {$item['parent']['xt_name']}
            </td>
            <td>
                {$item['xt_ids']}
            </td>
            <td class="text-right">
                <a class="btn btn-default btn-sm" href="{php echo $this->createWeburl('xiangmu_type', array('xt_id' => $item['xt_id'], 'op' =>'posts'))}" >编辑</a>
                <a class="btn btn-default btn-sm" onclick="return confirm('此操作不可恢复，确认吗？'); return false;" href="{php echo $this->createWeburl('xiangmu_type', array('xt_id' => $item['xt_id'], 'op' => 'delete'))}">删除</a>
            </td>
        </tr>
        {/loop}
    </table>
</form>
{/if}
{if $op == 'posts'}
<form class="form-horizontal" action="" method="post">
    <div class="panel panel-default">
        <div class="panel-heading">
            <h3 class="panel-title">添加服务分类</h3>
        </div>
        <div class="panel-body">
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >排序</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="xt_idss" name="xt_idss" value="{$items['xt_idss']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">排序[数字越大越靠前]</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >服务分类名称</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <input type="text" id="xt_name" name="xt_name" value="{$items['xt_name']}" class="form-control ng-pristine ng-untouched ng-valid ng-empty"  placeholder="" autocomplete="off">
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">服务分类名称</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >服务分类图标</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    {php echo tpl_form_field_image('xt_thumb', $items['xt_thumb'])}
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">服务分类图标</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >父级分类名称</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <select name="xt_p_id" id="xt_p_id" class="form-control">
                        <option value="">--请选择--</option>
                        {loop $fuji $item}
                            <option value="{$item['xt_id']}" {if $item['xt_id']==$items['xt_p_id']}selected{/if} >{$item['xt_name']}</option>
                        {/loop}
                    </select>
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block">父级分类名称</div>
            </div>
            <div class="form-group">
                <label for="" class="control-label col-sm-1" >是否使用</label>
                 <div class="form-controls col-sm-5" style="margin-left: 75px;">
                    <select name="xt_ids" id="xt_ids" class="form-control">
                        <option value="">--请选择--</option>
                        <option value="是" {if $items['xt_ids']=="是"}selected{/if} >是</option>
                        <option value="否" {if $items['xt_ids']=="否"}selected{/if} >否</option>
                    </select>
                </div>
                <div class="col-sm-1"></div>
                <div class="form-controls col-sm-4 help-block"></div>
            </div>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-12">
            <input name="token" type="hidden" value="{$_W['token']}" />
            <input type="submit" class="btn btn-primary col-lg-1" name="submit" value="提交" style="margin-left: 45%;" />
        </div>
    </div>
</form>
{/if} 